package com.example.shiwuyouproject.ui.fragment.home.viewmodel

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.fragment.my.activity.bean.MyApplicationBean

class LatestRecruitmentFragmentViewModel : BaseViewModel() {
    private val loginRepository by lazy { RetrofitClient.getApiService() }
    val getPostRecommendList = MutableLiveData<MutableList<MyApplicationBean>>()
    fun getPostRecommendLists(page: String) {
        launch(
            block = {
                val codeStatus = loginRepository.getPostRecommend("510700", page)
                getPostRecommendList.value = codeStatus.result().data
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
    fun getPostLatestLists(page: String) {
        launch(
            block = {
                val codeStatus = loginRepository.getPostLatest("510700", page)
                getPostRecommendList.value = codeStatus.result().data
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
}